home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / nameless.swf / scripts / DefineSprite_55_bomb / frame_1 / DoAction.as
Encoding:
Text File  |  2011-06-09  |  1.3 KB  |  64 lines

  1. stop();
  2. if(!setVars)
  3. {
  4.    var dropSpeed = 0;
  5.    var maxDropSpeed = 8;
  6.    var airSpeed = 0.5;
  7.    var xSpeed = random(18) + random(5);
  8.    _X = _X - 60;
  9.    _Y = _Y - 45;
  10.    var setVars = true;
  11. }
  12. var onEnterFrame = function()
  13. {
  14.    if(_root.pauseMode == false)
  15.    {
  16.       if(_root.cm.hitTest(this))
  17.       {
  18.          if(_currentframe == 1)
  19.          {
  20.             gotoAndStop("explode");
  21.          }
  22.          else if(_currentframe == 2 && !took && _root.cm.hitTest(g.hitter))
  23.          {
  24.             took = true;
  25.             if(_root.cm.hit == false)
  26.             {
  27.                if(_root.cm.invis <= 0)
  28.                {
  29.                   _root.cm.hit = true;
  30.                   _root.health -= 6;
  31.                }
  32.             }
  33.          }
  34.       }
  35.       if(_root.bound.hitTest(_X,_Y,true))
  36.       {
  37.          gotoAndStop(2);
  38.       }
  39.       if(_currentframe == 1)
  40.       {
  41.          _Y = _Y + dropSpeed;
  42.          _X = _X - xSpeed;
  43.          _rotation = _rotation + dropSpeed;
  44.          if(xSpeed > 0)
  45.          {
  46.             xSpeed -= airSpeed;
  47.          }
  48.          if(dropSpeed < maxDropSpeed)
  49.          {
  50.             dropSpeed += airSpeed;
  51.          }
  52.       }
  53.       else
  54.       {
  55.          _rotation = 0;
  56.       }
  57.       g.play();
  58.    }
  59.    else
  60.    {
  61.       g.stop();
  62.    }
  63. };
  64.